<template>
    <div id="app">
        <h1>用户登录</h1>
        <form>
            用户名:<input type="text" v-model="myForm.username"><br>
            密码:<input type="password" v-model="myForm.password"><br>
            <input type="button" value="登录" @click="login">
        </form>
    </div>
</template>

<script>
export default {
    data(){
        return{
            myForm:{
            username:'',
            password:''
        }
        }
    },
    methods:{
        login:function (){
            if(this.myForm.username==='admin'&&this.myForm.password==='admin'){
                this.$store.commit('changeLogin',true)
                this.$router.push("/routerindex")
            }else{
                alert('用户名密码错误')
            }
        }
    }
}
</script>

<style scoped>

</style>
